home *** CD-ROM | disk | FTP | other *** search
- Path: ausnews.austin.ibm.com!usenet
- From: "Marc R. Whitten" <whitten@ponder.csci.unt.edu>
- Newsgroups: comp.lang.c++
- Subject: Re: Array Assistance
- Date: Wed, 17 Jan 1996 08:18:32 -0800
- Organization: IBM -- Dallas Systems Center
- Message-ID: <30FD2158.5E30@ponder.csci.unt.edu>
- References: <4dh4rb$ekq@netnews.upenn.edu>
- NNTP-Posting-Host: marc.sl.dfw.ibm.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b5 (Win16; I)
-
- Arthur Ryan wrote:
- //...
- > int oda[773][28];
-
- This creates a 2 dimensional array. the first dimension ranges from
- 0 to 772. The second ranges from 0 to 27.
-
- > while (!fsin.eof())
- > {
- > for (i=0;i<774;i++);
- > {
- > for(j=0;j<29;j++)
- > {
- > fsin >> oda [i][j];
- > }
- > }
- > }
-
- This is probably your problem...your indexing in the for loops is
- off by one.... i.e. the last iteration of the i loop is 773, the last
- iteration in the j loop is 28, also one greater.
-
- > for (i=0;i<=774;i++)
- > {
- > for (j=0;j<=29;j++)
- > {
- > cout << oda [i][j];
- > }
- > cout << endl;
- > }
-
- Same thing here, except now its off by two since you are indexing using
- <=
-
- Hope this helps.
-
- Marc.
-